A DI token is the key used to register and look up a provider in the container. NestJS supports three token types: class references (most common), strings, and symbols. InjectionToken is the preferred approach for non-class tokens as it provides type safety.
Class reference — most common; TypeScript type serves as the token automatically via reflect-metadata.
String — e.g. 'DATABASE_URL'; requires @Inject('DATABASE_URL') at the injection site; prone to typos.
Symbol — e.g. Symbol('CONFIG'); unique and collision-safe; requires @Inject(SYMBOL).
InjectionToken — type-safe wrapper over string/symbol tokens; the preferred choice for non-class tokens.